package model

var RepositoryNames = struct { // repositories
	BlogSetting           string
	MemberRank            string
	MemberRankRestriction string
	MemberRankRule        string
	MemberTask            string
	IntegralTask          string
}{
	BlogSetting:           "setting",
	MemberRank:            "MemberRank",
	MemberRankRestriction: "MemberRankRestriction",
	MemberRankRule:        "MemberRankRule",
	MemberTask:            "MemberTask",
	IntegralTask:          "IntegralTask",
}

var RepositoryPreloadMap = map[string]map[string]string{
	RepositoryNames.BlogSetting: {
		"Name":     SettingColumns.SettingName,
		"Value":    SettingColumns.SettingValue,
		"Autoload": SettingColumns.Autoload,
	},
	RepositoryNames.MemberRank: {
		"Id":              SysMemberRankColumns.ID,
		"Name":            SysMemberRankColumns.Name,
		"Code":            SysMemberRankColumns.Code,
		"Desc":            SysMemberRankColumns.Description,
		"Remark":          SysMemberRankColumns.Remark,
		"PicId":           SysMemberRankColumns.PicID,
		"PicUrl":          SysMemberRankColumns.PicURL,
		"GrowthThreshold": SysMemberRankColumns.PointThreshold,
		"IsDefault":       SysMemberRankColumns.IsDefault,
		"Sort":            SysMemberRankColumns.Sort,
		"Status":          SysMemberRankColumns.Status,
	},
	RepositoryNames.MemberRankRestriction: {
		"Id":         SysMemberRankRestrictionColumns.RestrictionID,
		"RankId":     SysMemberRankRestrictionColumns.RankID,
		"TaskId":     SysMemberRankRestrictionColumns.TaskID,
		"Threshhold": SysMemberRankRestrictionColumns.Threshhold,
		"Sort":       SysMemberRankRestrictionColumns.Sort,
		"Status":     SysMemberRankRestrictionColumns.Status,
	},
	RepositoryNames.MemberRankRule: {
		"Id":         SysMemberRankRuleColumns.RuleID,
		"RankId":     SysMemberRankRuleColumns.RankID,
		"RuleType":   SysMemberRankRuleColumns.RuleType,
		"Regions":    SysMemberRankRuleColumns.Regions,
		"Mode":       SysMemberRankRuleColumns.Mode,
		"Value":      SysMemberRankRuleColumns.Value,
		"PeriodType": SysMemberRankRuleColumns.PeriodType,
		"Quota":      SysMemberRankRuleColumns.Quota,
		"Sort":       SysMemberRankRuleColumns.Sort,
		"Status":     SysMemberRankRuleColumns.Status,
	},
	RepositoryNames.MemberTask: {
		"Id":        SysMemberTaskColumns.ID,
		"Name":      SysMemberTaskColumns.Name,
		"Slug":      SysMemberTaskColumns.Slug,
		"Desc":      SysMemberTaskColumns.Description,
		"Remark":    SysMemberTaskColumns.Remark,
		"PicId":     SysMemberTaskColumns.PicID,
		"PicUrl":    SysMemberTaskColumns.PicURL,
		"Gems":      SysMemberTaskColumns.Gems,
		"Growth":    SysMemberTaskColumns.Growth,
		"Integrals": SysMemberTaskColumns.Integrals,
		"Sort":      SysMemberTaskColumns.Sort,
		"Status":    SysMemberTaskColumns.Status,
	},
	RepositoryNames.IntegralTask: {
		"Id":            SysUserIntegralTaskColumns.ID,
		"RuleName":      SysUserIntegralTaskColumns.RuleName,
		"RuleSlug":      SysUserIntegralTaskColumns.RuleSlug,
		"RuleType":      SysUserIntegralTaskColumns.RuleType,
		"PicId":         SysUserIntegralTaskColumns.PicID,
		"PicUrl":        SysUserIntegralTaskColumns.PicURL,
		"Frequency'":    SysUserIntegralTaskColumns.Frequency,
		"Points":        SysUserIntegralTaskColumns.Points,
		"EffectiveTime": SysUserIntegralTaskColumns.EffectiveTime,
		"Sort":          SysUserIntegralTaskColumns.Sort,
		"Ip":            SysUserIntegralTaskColumns.IP,
		"Description":   SysUserIntegralTaskColumns.Description,
		"Status":        SysUserIntegralTaskColumns.Status,
		"CreatedAt":     SysUserIntegralTaskColumns.CreatedAt,
		"UpdatedAt":     SysUserIntegralTaskColumns.UpdatedAt,
		"DeletedAt":     SysUserIntegralTaskColumns.DeletedAt,
	},
}

var RpcEntityNames = struct { // rpc entities
	BlogGeneralSetting    string
	MemberRank            string
	MemberRankRestriction string
	MemberRankRule        string
	MemberTask            string
	IntegralTask          string
}{
	BlogGeneralSetting:    "blogGeneralSetting",
	MemberRank:            "memberRank",
	MemberRankRestriction: "memberRankRestriction",
	MemberRankRule:        "memberRankRule",
	MemberTask:            "memberTask",
	IntegralTask:          "integralTask",
}

type ColumnSetting struct {
	Name          string /// rpc column name
	RpcEntityName string /// sqlboiler repository name
}

var RpcEntityPreloadMap = map[string]map[string]*ColumnSetting{
	RpcEntityNames.BlogGeneralSetting: {
		"dateFormat": &ColumnSetting{
			Name: "date_format",
		},
		"description": &ColumnSetting{
			Name: "blogdescription",
		},
		"email": &ColumnSetting{
			Name: "admin_email",
		},
		"language": &ColumnSetting{
			Name: "WPLANG",
		},
		"startOfWeek": &ColumnSetting{
			Name: "start_of_week",
		},
		"timeFormat": &ColumnSetting{
			Name: "time_format",
		},
		"timezone": &ColumnSetting{
			Name: "timezone_string",
		},
		"title": &ColumnSetting{
			Name: "blogname",
		},
		"url": &ColumnSetting{
			Name: "siteurl",
		},
		"pointsRestrictToday": &ColumnSetting{
			Name: "points_restrict_today",
		},
	},
	RpcEntityNames.MemberRank:            map[string]*ColumnSetting{},
	RpcEntityNames.MemberRankRestriction: map[string]*ColumnSetting{},
	RpcEntityNames.MemberRankRule:        map[string]*ColumnSetting{},
	RpcEntityNames.MemberTask:            map[string]*ColumnSetting{},
	RpcEntityNames.IntegralTask:          map[string]*ColumnSetting{},
}
